What are the evolutionary niches differentiating an apple from a pear?
I wouldn't be suprised if no one has hard data on this. In any case there is more than one answer to this question. 

Niches are defined more than one way. 

In the narrowest definition, the niche might be defined as the ability of the different trees to grow in different terrains or be eaten by different animals in the same environment.  I can't comment on that, but in most environments, there is in practice little difference between the two.  The classic example of this is Darwin's finches - where a single species eventually becomes many, each specializing in a specific kind of lifestyle (what they eat/where they net) on the islands of the Galapagos where they were situated.  

In the broadest definition of niche, they do have a different niche because they are different species, and their differences allow them to be eaten by different people.  In their highly domesticated environs, apples and pears each have a niche defined by the fact that they are both stocked in the produce sections for people to eat as they choose. 



Its worth mentioning that Darwin determined that different organisms can inhabit the same niche.  In his case he saw that on different islands of the Galapagos he saw that the finches had evolved into different species, each of which took up the role that a different bird might have back home.  so its possible that apples and pears may have substantially the same niche in their respective evolutionary histories.