If Sarah buys 3 bananas for every 5 apples and bought 12 bananas that means she bought 20 apples. (3/5 = 12/A solve and A=20)
Now we know that for every 4 apples she buys 2 pears. Because she bought 20 apples, Sarah bought 10 pears. (4/2 = 20/P solve and P=10)