Is there any way I can connect my laptop that only has VGA and HDMI ports to a DVI-only monitor?
Edit: The model is HP LP2065
Yes, you can use any adapter cable between HDMI to DVI. Then you use a cable to connect the display to the adapter cable.
To connect a DVI monitor to a VGA port on a laptop you will need a VGA-DVI converter. For more information about how to connect a DVI monitor to a VGA port on a laptop look at this question: How can I connect a DVI monitor to the VGA port in my laptop?.
VGA is compatible with DVI. That was part of the design of DVI, after all. You should avoid using the VGA port if at all possible because it's analog and lossy. You'll likely notice ghosting and other artifacts.
HDMI may be compatible with DVI, depending on your hardware. For example, AMD graphics cards ship with DVI-to-HDMI adapters. This only works because the hardware and software detect the change and speak in DVI protocol rather than HDMI.
For the definitive answer, ask HP.