Both of them suggest more or less the same thing, being physically on the branches of the tree, but vary slightly in the position in which the subject is found.
"In the tree" suggests a sense of hiding.
'The bird is hiding in the tree, safe from its predators'.
"On the tree" often refers to something that is sitting on the highest point of the tree and is more often used when we are looking above the trees. However, it can also have the same meaning as being within the trees. So maybe when you are walking in a nature trail, you can indicate to your friend, "Look! There is an owl ON the tree."
Hope that helps!