Generalize convert for dict

The convert function's second argument can be any associative type, not just another dict, so it should be written more generally.
Merge pull request #8686 from StephenVavasis/patch-11

Generalize convert for dict