There are 3 ways to do this, depending on how much time you have and how much money you're willing to spend.
Fastest - Taxi Cab
A taxi cab will run you about $26-28 (depending on traffic, mostly) and will take anywhere from 20-30 minutes, only very rarely worse than that.
Middle Option - Shuttle Bus
A shuttle bus runs between LaGuardia and JFK and costs $15 one-way and $27 for a round-trip ticket.
Time is about 40-60 minutes, depending on which terminal you get picked up from (they'll circle the whole airport collecting passengers at each terminal before departing).
Jump on the bus and pay the attendant inside the bus.
The shuttles you should look for are currently: NYC Airporter, All County Express, and ETS Air Shuttle. You can check the JFK airport page on interairport connections to see if the shuttles have changed their service (thanks, John!).
Cheapest - Bus+Subway+AirTrain
This will cost you exactly $9 ($5 if you already have an unlimited ride MetroCard), but will take you about 1 hour and 15 minutes, assuming no traffic or subway problems.
If LGA to JFK: Exit the airport, and look for the Public Bus signs. Take the Q33 bus ($2.50 or free if you have a transfer through your MetroCard) to the Roosevelt Avenue/74th St. subway station. Then enter the station and take the subway line E (another $2.25/free for MetroCard transfers) towards Jamaica. Exit at the Sutphin Blvd station. Buy a $5 MetroCard and take the AirTrain to whichever terminal you're flying from.
If JFK to LGA: Follow the signs for AirTrain. Buy a $5 MetroCard and take the AirTrain to Jamaica Station. (There are 2 AirTrain lines, so pay attention) Take the subway line E towards Manhattan, and get off at the Roosevelt Avenue/74th St station. Exit the station and take the Q33 bus to LaGuardia Airport.