Topological relation between bulk gap nodes and surface bound states: Application to iron-based superconductors