Relation is a set of ordered pairs.
Function is a relation for wich each element of the domain corresponds to exactly one element of the range.
The graph on the right shows the 6 flower species as the independent variables and their native habitats as the dependent variables. The domains are the flowers: plum blossom, lotus, musk rose, ixora, prim rose, foxglove; the ranges of the function are the countries: China, India, Malaysia, England. Since each of these flowers had 1 original nativity this is a function.
In the graph on the right I added the bombax ceiba flower specie, which was distributed in 3 places. The domains are now including plum blossom, lotus, musk rose, ixora, prim rose, foxglove, and bombax ceiba; the new ranges are China, India, Malaysia, England, and Australia. Since 1 of the domain had match with more than 1 range, the function failed and the graph is a relation.