By itself, the L298 can't do what you want to do (well - it could - more on that in a bit). What you need to use in addition to the L298 is it's sister chip - the L297:
It provides the current control via a chopper driver. As far as using the L298 by itself? Well - in theory you could monitor the current with a couple of the Arduino's analog input pins (additional circuitry in this stage will be needed - see the block diagram of the L297 in the datasheet), then vary the PWM output to the L298 controlling the windings - in short, you would be programmatically emulating the L297; there's enough information in the datasheet to get you started.
The upside (what bit there is) is that you could probably add modes and functions that the L297 doesn't offer.
All that said - there are more efficient drivers/boards available, based on MOSFET drivers. Look into what Pololu and similar companies offer.
Also - realize that RAMPS for the most part is a system (consisting of both hardware and software) meant for easily and in a standardized manner interfacing a particular set of stepper drivers to the Arduino Mega (along with other inputs and outputs, and other hardware designed for CNC, 3D printing in particular). The hardware acts as a carrier board for these drivers; one particular driver used is:
There are others as well with the same footprint as that carrier board, but with other actual stepper driver ICs.