Go to the folder where the files are located and run:
for f in *; do mv "$f" `echo $f | tr ' ' '_'`; done