Not all forms of dancing are the same. Dancing is a very broad term, basically meaning movement. Is all bodily movement other than necessary movements intrinsically evil? No of course not. The reason that St. Jean Vianney and other fathers of the Church criticize dancing is mainly because the immodesty of particular types of dances and the fact that dance halls are breeding grounds for sin. Another problem is that dances were held on Saturday night and even on Sunday, so people were dancing instead of sanctifying the Lord's Day.
The examples you cite from the Old Testament do not fall under SJV's criticism. David was not doing a tango. He was dancing by himself, and there is nothing to suggest it was sexually provocative. David was faulted because he was seen to be making a fool of himself, not because he was doing anything sinful. The passage from Ecclesiastes just mentions dancing, not any particular kind of dances and not under any particular circumstances. To give an analogy, suppose someone pointed to biblical passages showing that eating and sex are not sinful, and then arguing from that that gluttony and fornication are not sinful.
The Catholic Encyclopedia article mentions this distinction as well.
>As to social dancing, now so much in vogue, whilst in itself it is an indifferent act, moralists are inclined to place it under the ban, on account of the various dancers associated with it. Undoubtedly old national dances in which the performers stand apart, hardly, if at all, holding the partner's hand, fall under ethical censure scarcely more than any other kind of social intercourse. But, aside from the concomitants — place, late hours, décolleté, escorting, etc. — common to all such entertainments, round dances, although they may possibly be carried on with decorum and modesty, are regarded by moralists as fraught, by their very nature, with the greatest danger to morals. To them perhaps, but unquestionably still more obviously to masked balls, should be applied the warning of the Second Council of Baltimore, against "those fashionable dances, which, as at present carried on, are revolting to every feeling of delicacy and propriety". Needless to add that decency as well as the oft-repeated decrees of particular and general councils forbid clerics to appear, in any capacity whatever, on public dancing floors.
http://www.newadvent.org/cathen/04618b.htm