Answer: That depends on the fruit’s maturity. For example, fruit from store-bought tomatoes will normally be fertile and easy to germinate, as tomatoes are generally ripe when they are harvested and ripe fruits bear mature seeds. This is also the case for melons and most tree fruits (plums, cherries, oranges, etc.). On the contrary, many fruits considered to be vegetables – cucumbers, peas, and beans, for example – are harvested well before they are mature and therefore their seeds will not germinate. How can they? They are not even fully formed!
Peppers and squash complicate the situation a bit, because sometimes they are sold when mature, sometimes when they are immature. Green peppers and summer squash (zucchini, crookneck squash, pattypan squash, etc.) are harvested when the seeds are still tiny and immature, but red peppers and winter squash (pumpkins, acorn squash, spaghetti squash, etc.) are sold at full maturity, so only the seeds of the latter are mature and ready for sowing.
Note too that some types of fruit and vegetables are naturally sterile. Navel oranges, bananas, seedless watermelons and seedless grapes, for example, do not produce fully formed seeds (or at least not normally). So there is nothing to sow in these fruits.
The question now is … is sowing the seeds harvested fruits and vegetables bought at the market worthwhile?
Often these fruits come from varieties developed especially for greenhouse growing or for cultivating in a warm climate (California, Mexico, Florida, etc.) and these varieties may not have time to ripen in your home vegetable garden. Also, many store-bought fruits were harvested from F1 hybrids (first generation hybrids): these will not give plants identical to their parents, so the fruits produced can be quite different from the original ones. For these reasons, if you want to start your own vegetables, it is generally best to purchase seeds specially developed for the family garden or to harvest seeds from non-hybrid or heirloom varieties in your own garden. (If you want to start your own fruit trees from seed, however, be patient: you’ll be years away from harvesting anything!)
That said, it’s always fun to experiment and you want to try sowing seeds from mature store-bought fruits, why not? Lots of people start seeds from tropical fruits and grow them as houseplants (lemon trees, avocados, mangos, etc.), for example. These may never bear fruit (indoor conditions aren’t necessarily conducive to fruit production), but they make interesting foliage plants.