As generally described by Tester101, the standard approach is to install flat boards called jambs - horizontal to cover the cross beams and vertical to cover the upright studs. These are about 11/16 inch thick, and are available from home centers. These jambs are can be found in standard widths to fit the thickness of 2x4s plus 2 thicknesses of 1/2 inch wallboard. They then end up being flush on both sides with the wallboard or other wall surface. If the wall is a nonstnadard thickness, slightly larger jambs can be ripped to exact size.
Then the casings (surface moldings) are applied to bridge the area from the inside edge of jamb to the wall surface. There is usually a setback on the casings from the inside edge of the jamb (moving it away from the interior of the doorway) leaving a small step (usually about 1/8 to 1/4 inch) called a reveal.
The track for a sliding door could then be installed directly on the upper jamb toward the room side of the jamb. Most slding door tracks provide instructions about placement.
See, e.g., http://johnsonhardware.com/images/Install/SD/IN200SLD.pdf
A narrow flat molding, approximately 1/4 inch deeper than the track can be installed directly in front of the track, either nailing upward into the jamb or gluing it onto the track itself. Measure to be sure that it will not interfere with the door opening.