Dive bombers were inherently more accurate, because the steeper your dive, the more precisely you can place the bomb (especially when given a proper dive-bomb sight rather than just a gunsight).
Ju 87 Stuka crews could place bombs with an average miss distance of only 30 metres. Hawker Typhoon fighter-bombers could only achieve an average miss distance of 120 metres, and other fighter-bombers would probably have been much the same.
Fighter-bombers took over because they were more versatile and could defend themselves against enemy fighters - and air forces love versatility. Exactly the same argument is going on at present within the US armed forces between the USAF - which has long wanted to scrap the A-10 'Tankbuster' and replace it with multipurpose F-16s - and the Army, which points out that the A-10 can do the close support job far better than any F-16.
Dive bombers remained important in navies during WW2 because their ability to drop one very heavy bomb with great precision was needed in the anti-shipping role.
Tony Williams: Military gun and ammunition
website and discussion
forum