Is there a way to get a relative angle between 2 objects?

Something like:

https://dl.dropboxusercontent.com/u/14940709/imgs/angle_example.png

I know I could use cos or sin to get each angle, but then I would have to get the distances of 6 vectors, so is there a more efficient way to get a relative angles without having to do each one individually?