Add helper function to get all class labels possible for an index.

This simplifies one_vs_all classifier construction (and one_vs_one in the
future).