(CNN) New York Senate Democrats on Thursday passed legislation that would automatically register people to vote when they interact with certain state government agencies.

The bill , sponsored by state Sen. Michael Gianaris, would create a system of automatic voter registration when a person submits an application to the Department of Health or the Department of Motor Vehicles.

"At a time in our country when voting rights are under assault, New York must live up to its potential as a progressive leader. Access to the ballot box should be easy and fair, and enacting automatic voter registration would go a long way towards improving our democracy," Gianaris said.

The passage of the bill came as the state legislature opened its session this week.

The bill now heads to the state Assembly. If passed there and also signed into law by New York Gov. Andrew Cuomo, the measure would, at its earliest, go into effect in two years, according to Gianaris spokesman Alexander Marion. The Board of Elections would first need to determine whether the specific agencies are ready with the appropriate infrastructure.

Read More