For this dynamic condition, you can opt for four separate series which would be the labels to be shown if series are below or above the other one. In total its 4 because you have to check for above or below from each line (Blue and yellow).
Once you have set up the series, then you add them to the chart. Then you add the labels for these four series and here's comes the trick > right click on the labels and in the "Label option section", you will use the option of "Values From Cells" and there you map it to these two new series.
If you can share the workbook, I can try to add them and set it for you.