HP LaserJet Pro CP1025 is detected automatically by Ubuntu but it is not sufficient for printing. You should configure HPLIP.
At first time, check that HPLIP installed and its version is 3.11.1 at least
dpkg -l hplip
In Ubuntu 14.04 you should see something like this:
ii hplip 3.14.3-0ubun_amd64 HP Linux Printing and Imaging Sys
If your version is minor that 3.11.1, download and install the latest version from HPLIP site.
Now you should install printer driver via simple GUI program.
or in text console mode
Follow instructions, add printer at end.
Update 2023-11-12. Ubuntu 22.04: for a shared printer connected to a print server in the network (i.e home), you should select the driver for "HP LaserJet Pro CP1025nw".