To do this, you would add the graphics driver PPA with the following commands in terminal:
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
After this, you should now remove any current NVIDIA drivers by entering the following into your terminal:
sudo apt-get purge nvidia*
Now that you have done this, it is safe to install the latest version:
sudo apt-get install nvidia-driver-396
Please note that it is nvidia-driver-396 on Ubuntu 18.04, it is nvidia-396 on Ubuntu 16.04 but you are not using 16.04.