How can I calculate takeoff distance in a generic way?
For air carrier type aircraft, the chart you show in your question (sometimes called a "run-around-chart") is generally digitized in some form (performance data printed out on dispatch release, or in a Flight Management Computer on board the aircraft or handheld device provided to crews).

For light aircraft, likely there are many software apps available for the most popular types.

Here is a picture of an Apple APP I noted online for a Cessna 172.