They're for different purposes, so it depends on what you're trying to do.
For example, I have an arm I can use to grab things. However, I'm not a kind of arm; there are things arms can do I can't, such as being part of someone else's body. This is composition.
On the other hand, I am a hominid. Like all hominids, I can move about and grab things with my hands. If you wanted to have list of hominids so that you could tell all of them to move towards a table and grab a banana, I could be part of that list. A dog couldn't. This is inheritance.