A trainer is designed to work on strength and endurance training and typically provide more resistance than rollers. Riding rollers promotes good balance and a smooth pedal stroke. Many people incorporate both in their off-season training. So, it depends on your training goals as to which one is right for you.
Learn more about rollers versus bike trainers.