To do this manually you can use Slicer. Load the .nii file and save as DICOM using the DICOM input/export feature.
To do this automatically you can use plastimatch to convert from NII to DICOM.
However, you must build from scratch using the exact versions below (I did it on windows):
- InsightToolkit-4.5.0
- dcmtk-3.6.0
- plastimatch-1.5.17-beta
Follow instructions verbatim here:
http://plastimatch.org/getting_started.html
Then the command to convert is:
plastimatch.exe convert --input src.nii --output-dicom dst_directory