Gate-voltage control of spin interactions between electrons and nuclei in a semiconductor