Fix dependency conversion

Put word index before label, so that sorting does the right thing.