Can airline pilots communicate with dispatchers?
Yes, and it is a regulatory requirement that it is so.

§121.99   Communications facilities—domestic and flag operations.
(a) Each certificate holder conducting domestic or flag operations must show that a two-way communication system, or other means of communication approved by the FAA certificate holding district office, is available over the entire route. The communications may be direct links or via an approved communication link that will provide reliable and rapid communications under normal operating conditions between each airplane and the appropriate dispatch office, and between each airplane and the appropriate air traffic control unit.

The typical way to contact dispatch is through SELCAL which allows two way communications between two specific parties over HF or VHF radio.  To contact a dispatcher we would tune the COM associated with SELCAL to the proper frequency (these were charted on company airport pages and you would use one from an airport nearby that you are overflying) and then use our handheld microphone (with keypad) to dial a code for our dispatcher, which is noted on our release paperwork.
As long as you are monitoring a SELCAL frequency and dispatch (or someone else with your aircraft code) calls you, the airplane will announce &quot;SELCAL&quot; and typically a light or some other visual notification will come on.
Once connected, you talk to your dispatcher over that com radio the same as you would talk to ATC.  From there your dispatcher can connect you to maintenance, med link, or anyone else you might need to talk to.
For larger airplanes typically used on overwater routes you will probably also find a satellite phone in the cockpit that can be used as an alternative way to call dispatch.
Textual communications to and from dispatch are also possible using ACARS.