The standard distribution of the Independent JPEG Group's software (which is where you get the standard, free JPEG library) includes a program called cjpeg which will convert to JPEG from GIF (as well as from Targa, PPM, and RLE). djpeg converts the other way.