Constrained Metric Learning Via Distance Gap Maximization