The Best of Both Worlds: Bridging Quality and Diversity in Data Selection with Bipartite Graph