Added ClassName::fromObject method and companion test case.

Was there a particular reason for adding this dependency?