$> cat /dev/cdrom > ~/cd.iso
This will create an ISO image file for all contents on your CD device.
Now, if you want to create ISO with files/directories from your local conputer:
$> mkisofs -r -o file.iso /path/to/directory
Note: This is installed in Ubuntu by default.
Stupidly easy!
Source: http://ubuntuguide.org/wiki/Ubuntu:Feisty/CDDVDBurning