The Canadiens also received a third-round draft pick from the Stars.
Ryder originally was drafted by Montreal and played his first four NHL seasons with the Canadiens from 2003-04 through 2007-08.
Ryder carries a $3.5 million salary this season and is slated for unrestricted free agency in July.
Cole has two more years on his contract past this season at a $4.5 million cap hit.
"[Cole] gives us more size and strength to compete in the West," Stars general manager Joe Nieuwendyk said. "The fact that he has this year plus two years remaining on his contract is a little security for us."
Both players scored 35 goals last season, which established career highs for each player.
Cole has struggled this season with only three goals and three assists in 19 games. Ryder has six goals and five assists in 18 games this season.