The Problem.
Why do many good players not hit a driver off every par 4 and par 5? Surely they aren't worried about overshooting the green. Why not aim at every pin? Isn't that where we want the ball to end up? We need to have a strategy that tells us when the most obvious shot is the wrong shot. We need to have a strategy to take on the course that builds in a "margin for success".
The Solution.
Here's a simple way do this. The next time you are at the practice tee, pick out a target for full swings with a wedge. Hit a dozen golf balls and note how far each of them land from the target (only count good swings). What was the average distance they landed from the target? For a typical golfer (16 handicap and above), they will find that their margin for success is about 8% of the distance to the target. So for a 100-yard shot their margin is 8 yards. Practically speaking, when they hit a wedge to a flag their good swings will land the ball within an 8 yard circle (24 feet) around the cup. For a 150 yard shot the circle grows to 36 feet.
Take Away.
So when we are getting ready to pick our target, draw the appropriate circle around it. If the flag is tucked against one side of the green and the 24-foot circle encompasses a green-side bunker, that would not be a flag we would shoot at. The same reasoning goes for your tee shot.
If your not sure of the percentage of margin your game deserves, start with 8% and adjust after a round or two. Always go for the best target unless trouble lies within your "margin for success".